package vip.xiaonuo.modular.business.service.impl;


import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import vip.xiaonuo.core.context.login.LoginContextHolder;
import vip.xiaonuo.core.pojo.login.SysLoginUser;
import vip.xiaonuo.modular.business.param.BiApplication.EditParam;
import vip.xiaonuo.modular.business.param.BiApplication.QueryParam;
import vip.xiaonuo.modular.business.service.TripartiteApplicationService;
import vip.xiaonuo.modular.manage.biapplication.entity.BiApplication;
import vip.xiaonuo.modular.manage.biapplication.param.BiApplicationParam;
import vip.xiaonuo.modular.manage.biapplication.service.BiApplicationService;
import vip.xiaonuo.modular.manage.biuserapplication.service.BiUserApplicationService;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TripartiteApplicationServiceImpl implements TripartiteApplicationService {

    @Resource
    private BiUserApplicationService biUserApplicationService;

    @Resource
    private BiApplicationService biApplicationService;

    @Override
    public List<BiApplication> appList(QueryParam queryParam) {
        SysLoginUser sysLoginUser = LoginContextHolder.me().getSysLoginUser();
        List<BiApplication> biApplicationList = biUserApplicationService.findByUserId(sysLoginUser.getId(),queryParam.getName());
        return biApplicationList;
    }


    @Override
    public void edit(EditParam editParam) {
        BiApplicationParam biApplicationParam=new BiApplicationParam();
        BeanUtils.copyProperties(editParam,biApplicationParam);
        biApplicationService.updateisEnable(biApplicationParam);
    }
}
